package wms2010.gui.forms.ageClass;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.ComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableModel;

import wms2010.gui.forms.SimpleForm;


public class AbstractAgeClassForm extends SimpleForm {
	protected JButton addButton =  new JButton("Add");
	protected JButton removeButton = new JButton("Remove");
	protected JComboBox disciplineComboBox;
	
	public AbstractAgeClassForm(TableModel tableModel, final ComboBoxModel comboboxModel) {
		super();
		this.disciplineComboBox = new JComboBox(comboboxModel);
		this.labels.add(new JLabel("Name of Age Class:"));
		this.labels.add(new JLabel("Calculation Formula:"));
		this.textFields.add(new JTextField());
		this.textFields.add(new JTextField());

		JPanel toolbarDetails = new JPanel();
		JPanel eastPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
		eastPanel.add(addButton);
		eastPanel.add(removeButton);

		JLabel tollbarLabel = new JLabel("Disciplines");
		toolbarDetails.setLayout(new BorderLayout());
		toolbarDetails.add(tollbarLabel, BorderLayout.WEST);
		toolbarDetails.add(this.disciplineComboBox);
		
		toolbarDetails.add(eastPanel, BorderLayout.EAST);

		JTable disciplineTable = new JTable(tableModel);
		JScrollPane disciplineScrollpane = new JScrollPane(disciplineTable);
		disciplineTable.setFillsViewportHeight(true);

		this.center.setLayout(new BorderLayout());
		this.center.add(toolbarDetails, BorderLayout.NORTH);
		this.center.add(disciplineScrollpane);

	}
}
